package com.test;

/**
 * Created by IntelliJ IDEA.
 * User: adenysenko
 * Date: Nov 2, 2006
 * Time: 11:14:01 AM
 */
public class ProfiledExample {
    public static void main(String[] args) throws Exception{
        System.out.print("press enter to start>");
        System.in.read();
        new ProfiledExample().run();
        System.out.print("press enter to terminate>");
        System.in.read();
    }

    private void run() {
        methA();
        methB(0);
    }

    void methB(int depth){
        sleep(3000);
        if( depth>=2 ) return;
        methB(depth+1);
    }

    void methA(){
        sleep(9000);
    }

    void sleep(int msecs){
        try {
            System.out.println("sleeping "+msecs);
            Thread.sleep(msecs);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
    }
}
